﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Business.DatabaseSumAppService;
using Business.DatabaseSumAppService.Dto;
using Business.Models;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Domain.Repositories;

namespace Business.Controllers
{
    /// <summary>
    /// 调拨汇总控制器
    /// </summary>
    [RemoteService]
    [Area("Business")]
    [Route("api/business/databasesum")]
    public class DatabaseSumController : AbpController
    {
        private readonly IDatabaseSumAppService _databaseSumAppService;

        public DatabaseSumController(IDatabaseSumAppService databaseSumAppService)
        {
            _databaseSumAppService = databaseSumAppService;
        }

        /// <summary>
        /// 新增或修改调拨汇总
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("databasesum-post")]
        public  Task<DatabaseSumDto> CreateOrUpdate(DatabaseSumDto input)
        {
            return _databaseSumAppService.CreateOrUpdate(input);
        }

        /// <summary>
        /// 获取调拨汇总列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("databasesum-list")]
        public  Task<PagedResultDto<DatabaseSumDto>> GetDatabaseSumList(DatabaseSumInputDto input)
        {
            return _databaseSumAppService.GetDatabaseSumList(input);
        }

        /// <summary>
        /// 删除调拨汇总
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpDelete]
        [Route("databasesum-delete")]
        public  Task DeleteDatabaseSum(List<Guid> ids)
        {
            return _databaseSumAppService.DeleteDatabaseSum(ids);
        }

        /// <summary>
        /// 获取调拨汇总
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("databasesum-for-edit")]
        public  Task<DatabaseSumDto> GetDatabaseSumForEdit(Guid id)
        {
            return _databaseSumAppService.GetDatabaseSumForEdit(id);
        }




    }
}
